from flask import jsonify
from . import api_bp
from models import get_all_users

@api_bp.route('/users')
def users():
    users = get_all_users()
    # 转换为字典格式
    users_list = []
    for user in users:
        users_list.append({
            'id': user[0],
            'username': user[1],
            'email': user[3],
            'nickname': user[4],
            'status': user[5],
            'created_at': user[6]
        })
    return jsonify(users_list)